package org.gw.ylc.base.ctrl;

import org.gw.ylc.base.model.GradeMajor;
import org.gw.ylc.base.model.Major;
import org.gw.ylc.base.service.GradeMajorService;
import org.gw.ylc.base.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("major")
public class MajorCtrl {
	@Autowired
	private MajorService majorService;
	@Autowired
	private GradeMajorService gradeMajorService;

	@RequestMapping("getMajors")
	@ResponseBody
	public Object getMajors(String department) {
		Iterable<Major> all = majorService.findByDepartment(department);
		return all;
	}

	@RequestMapping("getGradeMajors")
	@ResponseBody
	public Object getGradeMajors() {
		Iterable<GradeMajor> all = gradeMajorService.findAll();
		return all;
	}
}
